package com.acsapp;

import android.widget.Spinner;
import android.widget.ArrayAdapter;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.Toast;

public class PMOselect extends Activity {
    /** Called when the activity is first created. */
	
	Context context = this;
	Spinner spinner;
	ArrayAdapter<CharSequence> adapter;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    
	    setContentView(R.layout.pmosel);

	    spinner = (Spinner) findViewById(R.id.spinner);
	    adapter = ArrayAdapter.createFromResource(
	            this, R.array.planets_array, android.R.layout.simple_spinner_item);
	    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	    spinner.setAdapter(adapter);
	    spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
	   
	}
    
    public class MyOnItemSelectedListener implements OnItemSelectedListener {

        public void onItemSelected(AdapterView<?> parent,
            View view, int pos, long id) {
        	
        	if (pos == 3) {
        		
        		Toast.makeText(parent.getContext(), "add", Toast.LENGTH_LONG).show();
        	}
        	else {
        		Toast.makeText(parent.getContext(), "The promotion data for " +
        			parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
        	}
        }

        public void onNothingSelected(AdapterView parent) {
          // Do nothing.
        }
    }
    
    public void addItems(Editable promo){
    	
    	
    	
    }
    
}


